cmake_minimum_required(VERSION 3.6.0)
project(protos)

if(UNIX)
	add_compile_options(-std=c++11)
	find_package(Protobuf REQUIRED)
	if(PROTOBUF_FOUND)
		message("Protobuf Found")
		message("Protobuf_LIBRARIES: " ${Protobuf_LIBRARIES})
	endif(PROTOBUF_FOUND)
	include_directories(${Protobuf_INCLUDE_DIRS})
	set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
	protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS AgentId.proto ChatMessage.proto MessageToClient.proto MessageToServer.proto PingPacket.proto)
	message(${PROTO_SRCS})
	message(${PROTO_HDRS})
	add_library(${PROJECT_NAME} SHARED ${PROTO_SRCS} ${PROTO_HDRS})
	target_link_libraries(${PROJECT_NAME} INTERFACE ${Protobuf_LIBRARIES})
	
endif(UNIX)
